@inject('swipers','App\Models\Slide')
<div class="swiper-container">
    <div class="swiper-wrapper">
        @foreach($swipers::all() as $swiper)
            <div class="swiper-slide">
                <div style='background-image:url({{$swiper->url}});height:624px;width: 100%;'></div>
            </div>
        @endforeach
        <div class="swiper-pagination"></div>

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>

        <!-- 如果需要滚动条 -->
        <div class="swiper-scrollbar"></div>
    </div>
</div>
<style>
    .swiper-container {
        width: 100%;
        height: 624px;
    }
</style>
@push('scripts')
    <script type="text/javascript">
        var mySwiper = new Swiper('.swiper-container', {
            direction: 'horizontal',
            loop: true,
            autoplay: 3000,
            paginationType: 'fraction',
            // 如果需要分页器
            pagination: '.swiper-pagination',

            // 如果需要前进后退按钮
            nextButton: '.swiper-button-next',
            prevButton: '.swiper-button-prev',

            // 如果需要滚动条
            scrollbar: '.swiper-scrollbar',
        })
    </script>
@endpush

